<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"content="width=device-width, initialscale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <!-- 显示数组中的值 -->
        <div v-for="user in userList">
            {{user.name}}----{{user.age}}
        </div>
    </div>
    <script src="vue.min.js"></script>
    <script src="vue-router.min.js"></script>
    <script src="axios.min.js"></script>
    <script>
        new Vue({
            el: '#app',
            data: {
                userList:[]
            },
            created() {
                this.getUserList()
            },
            methods: {
                getUserList() {
                    // axios.get("url").then(请求成功方法).catch(请求失败方法)
                    axios.get("data.json") // axios路径
                    .then(response => {
                        this.userList = response.data.data.items
                        //console.log(response.data.data.items)
                    }) // 请求成功执行方法
                    .catch(error => {
                        console.log('catch() ...')
                    }) // 请求失败执行方法
                }
            },
        })
    </script>
</body>

</html>